home *** CD-ROM | disk | FTP | other *** search
- package netscape.debug;
-
- public class ThreadState {
- private Thread thread;
- private boolean valid;
- private boolean runningHook;
- private boolean resumeWhenDone;
- private int status;
- private int continueState;
- StackFrameInfo[] stack;
- private Object returnValue;
- private Throwable currentException;
- private ThreadHook savedHook;
- private int currentFramePtr;
- private ThreadState previous;
- public static final int THR_STATUS_UNKNOWN = 1;
- public static final int THR_STATUS_ZOMBIE = 2;
- public static final int THR_STATUS_RUNNING = 3;
- public static final int THR_STATUS_SLEEPING = 4;
- public static final int THR_STATUS_MONWAIT = 5;
- public static final int THR_STATUS_CONDWAIT = 6;
- public static final int THR_STATUS_SUSPENDED = 7;
- public static final int THR_STATUS_BREAK = 8;
- public static final int DEBUG_STATE_DEAD = 1;
- public static final int DEBUG_STATE_RUN = 2;
- public static final int DEBUG_STATE_RETURN = 3;
- public static final int DEBUG_STATE_THROW = 4;
-
- public static native ThreadState getThreadState(Thread var0) throws InvalidInfoException;
-
- public Thread getThread() {
- return this.thread;
- }
-
- public boolean isValid() {
- return this.valid;
- }
-
- public boolean isRunningHook() {
- return this.runningHook;
- }
-
- public int getStatus() {
- return this.status;
- }
-
- public native int countStackFrames() throws InvalidInfoException;
-
- public native StackFrameInfo getCurrentFrame() throws InvalidInfoException;
-
- public synchronized StackFrameInfo[] getStack() throws InvalidInfoException {
- if (this.stack == null) {
- this.stack = new StackFrameInfo[this.countStackFrames()];
- }
-
- if (this.stack.length == 0) {
- return this.stack;
- } else {
- StackFrameInfo var1 = this.getCurrentFrame();
- this.stack[this.stack.length - 1] = var1;
-
- for(int var2 = this.stack.length - 2; var2 >= 0; --var2) {
- var1 = var1.getCaller();
- this.stack[var2] = var1;
- }
-
- return this.stack;
- }
- }
-
- public void leaveSuspended() {
- this.resumeWhenDone = false;
- }
-
- public synchronized void resume() {
- if (this.runningHook) {
- this.resumeWhenDone = true;
- } else {
- this.resume0();
- }
- }
-
- private native void resume0();
-
- public int getContinueState() {
- return this.continueState;
- }
-
- public Object getReturnValue() throws IllegalStateException {
- if (this.continueState != 3) {
- throw new IllegalStateException("no value being returned");
- } else {
- return this.returnValue;
- }
- }
-
- public Throwable getException() throws IllegalStateException {
- if (this.continueState != 4) {
- throw new IllegalStateException("no exception throw in progress");
- } else {
- return this.currentException;
- }
- }
-
- public void setThreadHook(ThreadHook var1) {
- this.savedHook = var1;
- }
-
- public ThreadHook getThreadHook() {
- return this.savedHook;
- }
- }
-